package com.aspose.cells;

import java.util.Iterator;

class zaul extends CollectionBase {
   WorksheetCollection b;
   int c;
   int d;

   zaul(WorksheetCollection var1) {
      this.b = var1;
      this.c = 0;
      this.d = 0;
   }

   zauk a(long var1) {
      for(int var3 = 0; var3 < this.a.size(); ++var3) {
         zauk var4 = (zauk)this.a.get(var3);
         if ((long)var4.a == (var1 & 4294967295L)) {
            return var4;
         }
      }

      return null;
   }

   int a(String var1, Worksheet var2, boolean var3) {
      if (var3) {
         int var4 = this.a((byte)1, new String[]{var1});
         if (var4 != -1) {
            return var4;
         }
      }

      ++this.c;
      zauk var5 = new zauk(this, (byte)1, new String[]{var1}, (PivotPageFields)null, false, this.c, var2);
      return this.a(var5);
   }

   int a(zauk var1) {
      var1.a(this.d++);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
      return this.getCount() - 1;
   }

   int a(byte var1, String[] var2, boolean var3, PivotPageFields var4) {
      int var5 = this.a((byte)1, var2);
      if (var5 != -1) {
         return var5;
      } else {
         ++this.c;
         zauk var6 = new zauk(this, var1, var2, var4, var3, this.c, (Worksheet)null);
         return this.a(var6);
      }
   }

   public zauk a(int var1) {
      return (zauk)this.a.get(var1);
   }

   public int a(byte var1, String[] var2) {
      int var3 = -1;
      boolean var4 = false;
      Iterator var5 = this.iterator();

      do {
         if (!var5.hasNext()) {
            return -1;
         }

         zauk var6 = (zauk)var5.next();
         ++var3;
         var4 = true;
         if (var6.e == null || var2 == null) {
            return -1;
         }

         if (var6.d == var1 || var6.e.length == var2.length) {
            for(int var7 = 0; var7 < var2.length; ++var7) {
               if (!var2[var7].equals(var6.e[var7].a())) {
                  var4 = false;
                  break;
               }
            }
         }
      } while(!var4);

      return var3;
   }

   zauk a(zauk var1, Worksheet var2) throws Exception {
      if (var1.c.b == this.b) {
         ++var1.o;
         return var1;
      } else {
         int var3 = this.a(var1.d, var1.g());
         if (var3 != -1) {
            ++this.a(var3).o;
            return this.a(var3);
         } else {
            ++this.c;
            zauk var4 = new zauk(this, this.c, var2);
            var4.a(var1);
            this.a(var4);
            return var4;
         }
      }
   }

   void a(int var1, int var2, Worksheet var3) {
      for(int var4 = 0; var4 < this.getCount(); ++var4) {
         zauk var5 = this.a(var4);
         var5.b(var1, var2, var3);
      }

   }

   void b(zauk var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   zauk b(int var1) {
      for(int var2 = 0; var2 < this.a.size(); ++var2) {
         zauk var3 = (zauk)this.a.get(var2);
         if (var3.r == var1) {
            return var3;
         }
      }

      return null;
   }

   void c(zauk var1) {
      this.a.remove(var1);
   }

   // $FF: synthetic method
   public Object get(int x0) {
      return this.a(x0);
   }
}
